﻿using System.Web;
using System.Web.Routing;
using Sissonix.ExtRest.Processors;

namespace Sissonix.ExtRest
{
    /// <summary>
    /// Reroutes requests to RestHandler.
    /// </summary>
    public class RestRouteHandler : IRouteHandler
    {
        /// <summary>
        /// Gets the name of the service.
        /// </summary>
        /// <value>The name of the service.</value>
        public string ServiceName { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="RestRouteHandler"/> class.
        /// </summary>
        /// <param name="serviceName">Name of the service.</param>
        public RestRouteHandler(string serviceName)
        {
            ServiceName = serviceName;
        }

        /// <summary>
        /// Provides the object that processes the request.
        /// </summary>
        /// <param name="requestContext">An object that encapsulates information about the request.</param>
        /// <returns>An object that processes the request.</returns>
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            return new MasterProcessor();
        }
    }
}
